package com.hc.android.research.views;

import java.util.ArrayList;
import java.util.List;

import com.hc.android.research.R;
import com.hc.android.research.component.ItemView;
import com.hc.android.research.component.ItemViewAdapter;
import com.hc.android.research.dom.Item;
import com.hc.android.research.persistence.ResearchDAO;

import android.app.ListActivity;
import android.os.Bundle;

public class DataView extends ListActivity {

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dataview);
        
        ResearchDAO researchDAO = new ResearchDAO();
        List<Item> items = researchDAO.getItems(this);
        List<ItemView> itemViewList = new ArrayList<ItemView>();
        
        for(int i = 0; i < items.size(); i++)
        {
        	Item item = items.get(i);
        	
        	ItemView listItem = new ItemView(this);
        	listItem.setItem(item, this);
        	itemViewList.add(listItem);
        }
                
       setListAdapter(new ItemViewAdapter(this, itemViewList));
    }
    @Override
    protected void onPause() {
        super.onPause();
        // Another activity is taking focus (this activity is about to be "paused").
    }

}
